package net.andersand.games.yatzy;

import net.andersand.games.yatzy.Dice.Die;

/**
 * Listener interface for operations between the YatzyFrame
 * and the Game.
 * 
 * @author Anders Sandberg Nordbø
 */
interface YatzyListener {
	/**
	 * Invoked when rolling dices
	 */
	void rollDices();

	/**
	 * Invoked when selecting a die in order to keep it.
	 * Dice that are locked are not thrown again the next throw.
	 * @param j
	 * @return The die that is locked/unlocked after toggle
	 */
	Die toggleLockDie(int j);
	
	/**
	 * Invoked when choosing where to put the dice after turn completed.
	 * @param type Specifies the kind of yatzy score that was chosen for the resulting thrown dice
	 * @return Score which was added to player, or null if player already had scored this type
	 */
	Score setScore(ScoreType type);

	/**
	 * Finds the player with the specified id
	 * @param id
	 * @return the player, or null
	 */
	Player getPlayer(int id);
	
	/**
	 * Clears player dice (removes locking and values)
	 */
	void resetPlayerTurn();

	/**
	 * Finds the next player without touching turns
	 * @return the next player
	 */
	Player getNextPlayer();
	
	/**
	 * Ends the game early
	 * @return results as text
	 */
	String endGame();
}
